package com.hongye.backstage.controller;

import com.hongye.backstage.entity.GroupLookHouseEntity;
import com.hongye.backstage.service.GroupLookHouseService;
import com.hongye.backstage.vo.FindGroupLookHouseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

/**
 * @author caojianbin
 * @time 2022/4/20
 */
@RestController
@RequestMapping("/backstage/GroupLookHouse")
public class GroupLookHouseController {

    @Autowired
    private GroupLookHouseService groupLookHouseService;

    /**
     * @param groupLookHouseVo
     * @return
     * 查询后台要管理团购信息
     */
    @RequestMapping("/findGroupLookHouse")
    public List<GroupLookHouseEntity> findGroupLookHouse(@RequestBody FindGroupLookHouseVo groupLookHouseVo) throws IOException {
        List<GroupLookHouseEntity> lookHouseEntities =   groupLookHouseService.findGroupLookHouse(groupLookHouseVo);
        return lookHouseEntities;
    }

    /**
     * 将需要团购的房源信息添加到es中
     */
    @RequestMapping("/addToEs")
    public void addToEs(){
        groupLookHouseService.addToES();
    }
}
